package com.atguigu.jxc.controller;


import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/supplier")
public class SupplierController {

    @Autowired
    SupplierService supplierService;

    @RequestMapping("/list")
    @RequiresPermissions(value = "供应商管理")
    public Map<String,Object> list(Integer page,Integer rows, String supplierName){
        return supplierService.list(page,rows,supplierName);
    }

    @RequestMapping("/save")
    @RequiresPermissions(value = "供应商管理")
    public ServiceVO save(Supplier supplier){

        return supplierService.save(supplier);
    }

    @RequestMapping("/delete")
    @RequiresPermissions(value = "供应商管理")
    public ServiceVO delete(String ids){
        return supplierService.delete(ids);
    }

    @RequestMapping("/getComboboxList")
    @RequiresPermissions(value = "供应商管理")
    public List<Supplier> getComboboxList (String q){
        return supplierService.getComboboxList(q);
    }







}
